<?php

namespace app\site\service\site;

use app\model\site\User;
use app\site\service\traits\InstanceTrait;
use think\db\Query;

class UserService extends \app\site\service\SiteBaseService
{

    use InstanceTrait;

    function initialize()
    {
        $this->model = new User();
    }

    function formatData(array $data): array
    {
        if ($data['password']??''){
            $data['password'] = md5($data['password']);
        }
        return $data;
    }

    public function query(): Query
    {
        return $this->setWith(['level', 'storeManager'])->makeQuery()->withoutField(['password']);
    }

}
